package cn.iocoder.an.module.mold.dal.mysql.account;

import java.util.*;
import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.account.AccountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.account.vo.*;

/**
 * 模具台账 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface AccountMapper extends BaseMapperX<AccountDO> {

    default PageResult<AccountDO> selectPage(AccountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccountDO>()
                .likeIfPresent(AccountDO::getName, reqVO.getName())
                .likeIfPresent(AccountDO::getCode, reqVO.getCode())
                .eqIfPresent(AccountDO::getDrawingNoId, reqVO.getDrawingNoId())
                .eqIfPresent(AccountDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(AccountDO::getDevId, reqVO.getDevId())
                .eqIfPresent(AccountDO::getTotalCavity, reqVO.getTotalCavity())
                .eqIfPresent(AccountDO::getAvailableCavity, reqVO.getAvailableCavity())
                .eqIfPresent(AccountDO::getTotalUsageCount, reqVO.getTotalUsageCount())
                .eqIfPresent(AccountDO::getUsedCount, reqVO.getUsedCount())
                .eqIfPresent(AccountDO::getWarningCount, reqVO.getWarningCount())
                .eqIfPresent(AccountDO::getDelayCount, reqVO.getDelayCount())
                .eqIfPresent(AccountDO::getWarehouseId, reqVO.getWarehouseId())
                .eqIfPresent(AccountDO::getStorageId, reqVO.getStorageId())
                .eqIfPresent(AccountDO::getBomCategoryId, reqVO.getBomCategoryId())
                .eqIfPresent(AccountDO::getOprationStep, reqVO.getOprationStep())
                .eqIfPresent(AccountDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(AccountDO::getUpkeepId, reqVO.getUpkeepId())
                .betweenIfPresent(AccountDO::getLastUpkeepTime, reqVO.getLastUpkeepTime())
                .betweenIfPresent(AccountDO::getNextUpkeepTime, reqVO.getNextUpkeepTime())
                .eqIfPresent(AccountDO::getUpkeeperId, reqVO.getUpkeeperId())
              //  .betweenIfPresent(AccountDO::getUpkeepTime, reqVO.getUpkeepTime())
                .betweenIfPresent(AccountDO::getLastRecheckTime, reqVO.getLastRecheckTime())
                .betweenIfPresent(AccountDO::getNextRecheckTime, reqVO.getNextRecheckTime())
                .eqIfPresent(AccountDO::getRecheckerId, reqVO.getRecheckerId())
              //  .betweenIfPresent(AccountDO::getRecheckTime, reqVO.getRecheckTime())
                .eqIfPresent(AccountDO::getBorrowerId, reqVO.getBorrowerId())
                .betweenIfPresent(AccountDO::getBorrowTime, reqVO.getBorrowTime())
                .eqIfPresent(AccountDO::getReturnerId, reqVO.getReturnerId())
                .betweenIfPresent(AccountDO::getReturnTime, reqVO.getReturnTime())
                .eqIfPresent(AccountDO::getInventoryStatus, reqVO.getInventoryStatus())
                .eqIfPresent(AccountDO::getUsageStatus, reqVO.getUsageStatus())
                .eqIfPresent(AccountDO::getRepairStatus, reqVO.getRepairStatus())
                .eqIfPresent(AccountDO::getUpkeepStatus, reqVO.getUpkeepStatus())
                .eqIfPresent(AccountDO::getRecheckStatus, reqVO.getRecheckStatus())
                .betweenIfPresent(AccountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AccountDO::getId));
    }

}